<%@ include file="/WEB-INF/views/includes.jsp" %>
<%@ include file="/WEB-INF/views/header.jsp" %>
<%@ page session="false" %>

<table style="width:100%;margin:0px;">
	<tr>
		<td>
			<h1 style="margin:0px;">Faculty View</h1>
		</td>
		<td style="text-align:right;" align="right">
			<a class="operation-link icon-link" href="<c:url value='/course/add'/>"><img style="margin-right:3px;vertical-align:text-top;" src="<c:url value='/resources/images/book_add.png' />" />Add Course</a>
			<a class="operation-link icon-link" href="<c:url value='/document/add'/>"><img style="margin-right:3px;vertical-align:text-top;" src="<c:url value='/resources/images/page_white_add.png' />" />Add Document</a>
		</td>	
	</tr>
</table>

<%--
***********************************************************************************
							Enrolled Courses
***********************************************************************************
 --%>
<p style="font-weight: bold;">
	<img style="vertical-align:middle;margin-right:5px;" src="<c:url value='/resources/images/book.png' />"/> 
	You are instructing the following courses:
</p>

<p>To share existing documents with a course, register students in a course, update attributes of a course, or delete the course, select the <img style="vertical-align:middle;" src="<c:url value='/resources/images/book_edit.png' />" /> icon to the left course code below.  To add a new course, select the <b><img style="vertical-align:text-top;margin-right:3px;" src="<c:url value='/resources/images/book_add.png' />" />Add Course</b> link above.</p>

<c:choose>
	<c:when test="${fn:length(courses) > 0}">
		<table style="width:100%;" class="bluetable">
			<tr>
				<th style="width:45px;">&nbsp;</th>
				<th style="width: 10%"><b>Code</b></th>
				<th style="width: 30%"><b>Course Name</b></th>
				<th style="width: 30%"><b>Students</b></th>
				<th style="width: 30%"><b>Documents</b></th>
			</tr>
			<c:forEach var="course" items="${courses}">
				<tr>
					<td>
						<div style="width:45px;">
						<a class="icon-link" style="padding:0px;" href="<c:url value='/course/${course.crn}'/>">
							<img style="margin:0px;vertical-align:text-top;" src="<c:url value='/resources/images/book_edit.png' />" />
						</a>
						<a class="icon-link" href="<c:url value='/course/delete/${course.crn}'/>">
							<img style="margin:0px;vertical-align:text-top;" src="<c:url value='/resources/images/book_delete.png' />" />
						</a>
						</div>
					</td>
					<td>${course.code}</td>
					<td>${course.name}</td>
					<td>
						<c:forEach var="student" items="${course.students}">
							${student.name}<br/>
						</c:forEach>
					</td>
					<td>
						<c:forEach var="document" items="${course.documents}">
							<a class="icon-link document-link" href="<c:url value='/document/${document.id}'/>">
								<img style="vertical-align:text-top;" src="<c:url value='/resources/images/page_white_edit.png' />" />
							</a>
							<a class="icon-link document-link" href="javascript:alert('This feature was not completed for this assignment. (Not really necessary).');">
								<img style="margin-right:5px;" src="<c:url value='/resources/images/page_white_put.png' />"/> 
								${document.fileName}
							</a><br/>
						</c:forEach>		
					</td>
				</tr>
			</c:forEach>
		</table>
	</c:when>
	<c:otherwise>
		<p style="font-style:italic;margin-left:20px;">You are not actively instructing any courses.</p>
	</c:otherwise>
</c:choose>

<%--
***********************************************************************************
							My Documents
***********************************************************************************
 --%>
<p style="font-weight:bold;margin-top:30px;">
	<img style="vertical-align:middle;margin-right:5px;" src="<c:url value='/resources/images/page_white.png' />"/> 
	My Documents:
</p>

<c:choose>
	<c:when test="${fn:length(myDocuments) > 0}">
		<table style="width:400px;" class="bluetable">
			<tr>
				<th style="width: 50%"><b>Document Name</b></th>
			</tr>
			<c:forEach var="document" items="${myDocuments}">
				<tr>
					<td>
						<a class="icon-link document-link" href="<c:url value='/document/${document.id}'/>">
							<img style="vertical-align:text-top;" src="<c:url value='/resources/images/page_white_edit.png' />" />
						</a>
						<a class="icon-link document-link" href="javascript:alert('This feature was not completed for this assignment. (Not really necessary).');">
							<img style="margin-right:5px;" src="<c:url value='/resources/images/page_white_put.png' />"/> 
							${document.fileName}
						</a>	
					</td>
				</tr>
			</c:forEach>
		</table>
	</c:when>
	<c:otherwise>
		<p style="font-style:italic;margin-left:20px;">You do not have any documents uploaded to your secure store.</p>
	</c:otherwise>
</c:choose>

<%--
***********************************************************************************
							Shared Documents
***********************************************************************************
 --%>
<p style="font-weight:bold;margin-top:30px;">
	<img style="vertical-align:middle;margin-right:5px;" src="<c:url value='/resources/images/page_white_go.png' />"/> 
	Shared Documents:
</p>

<c:choose>
	<c:when test="${fn:length(sharedDocuments) > 0}">
		<table style="width:400px;" class="bluetable">
			<tr>
				<th style="width: 50%"><b>Document Name</b></th>
				<th style="width: 50%"><b>Shared By</b></th>
			</tr>
			<c:forEach var="document" items="${sharedDocuments}">
				<tr>
					<td>
						<a class="icon-link document-link" href="javascript:alert('This feature was not completed for this assignment. (Not really necessary).');">
							<img style="margin-right:5px;" src="<c:url value='/resources/images/page_white_put.png' />"/> 
							${document.fileName}
						</a>	
					</td>
					<td>
						${document.creator.name}
					</td>
				</tr>
			</c:forEach>
		</table>
	</c:when>
	<c:otherwise>
		<p style="font-style:italic;margin-left:20px;">There are currently no documents being directly shared with you.</p>
	</c:otherwise>
</c:choose>

<%@ include file="/WEB-INF/views/footer.jsp" %>
